// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SourceFile

package com.sgame.android.data;

import android.os.Parcel;
import android.os.Parcelable;
import com.sgame.android.data.Tunnel;
import org.json.*;

// Referenced classes of package com.mobage.global.android.data:
//            TunnelTransmittable

public class User
    implements Parcelable, TunnelTransmittable
{
    public static enum Field
    {
        ID, USER_ID, DISPLAY_NAME, NICKNAME, THUMBNAIL_URL, ABOUT_ME, HAS_APP, AGE_RESTRICTED, IS_FAMOUS, AGE, 
        MUTUAL_FRIENDS, PENDING_FRIEND_REQUESTS, ADDRESSES, BIRTHDAY, GAMERTAG, BADGE_ID, OAUTH2_TOKEN, OAUTH_TOKEN, AUTH_TOKEN, OAUTH_SECRET, 
        RECORDID, FIRST_NAME, LAST_NAME, DESCRIPTION, MESSAGES, VALIDATED, UUID, OPTIN, PHOTO_URL, EMAIL, 
        GRADE, GENDER, JOB_TYPE, BLOOD_TYPE, IS_VERIFIED;
    }
/*
    public static class __private
    {

        public static final int a = 0;
        public static final int b = 1;
        public static final int c = 2;
        public static final int d = 3;

        public __private()
        {
        }
    }
*/

    public static JSONArray fieldsToJsonArray(Field fields[])
    {
        JSONArray jsonarray = new JSONArray();
        if(fields == null)
            fields = (new Field[] {
                Field.ID, Field.DISPLAY_NAME, Field.HAS_APP, Field.THUMBNAIL_URL
            });
        int i1 = fields.length;
        for(int j1 = 0; j1 < i1; j1++)
        {
            Field field = fields[j1];
            jsonarray.put(field.name());
        }

        return jsonarray;
    }

    public User()
    {
        a = "";
        b = "";
        c = "";
        d = "";
        e = "";
        f = "";
        g = false;
        h = false;
        i = false;
        j = 0;
        n = "";
        verified = false;
    }

    public String getId()
    {
        return a;
    }

    public void setId(String id)
    {
        a = id;
    }

    public String getUid()
    {
        return a;
    }

    public void setUid(String id)
    {
        a = id;
    }

    public String getDisplayName()
    {
        return c;
    }

    public void setDisplayName(String displayName)
    {
        c = displayName;
    }

    public String getNickname()
    {
        return d;
    }

    public void setNickname(String nickname)
    {
        d = nickname;
    }

    public String getAboutMe()
    {
        return f;
    }

    public void setAboutMe(String aboutMe)
    {
        f = aboutMe;
    }

    public int getAge()
    {
        return j;
    }

    public void setAge(int age)
    {
        j = age;
    }

    public boolean isHasApp()
    {
        return g;
    }

    public boolean getHasApp()
    {
        return g;
    }

    public void setHasApp(boolean hasApp)
    {
        g = hasApp;
    }

    public String getThumbnailUrl()
    {
        return e;
    }

    public void setThumbnailUrl(String thumbnailUrl)
    {
        e = thumbnailUrl;
    }

    public boolean getIsAgeRestricted()
    {
        return h;
    }

    public void setAgeRestricted(boolean ageRestricted)
    {
        h = ageRestricted;
    }

    public boolean getIsFamous()
    {
        return i;
    }

    public void setIsFamous(boolean isFamous)
    {
        i = isFamous;
    }

    public int getGrade()
    {
        return k;
    }

    public void setGrade(int grade)
    {
        k = grade;
    }

    public static User createFromJson(JSONObject json)
    {
    	User user;
        (user = new User()).setFromJson(json);
        user.setJsonObject(json);
        return user;
    }

    public String getMutualFriends()
    {
        return l;
    }

    public void setMutualFriends(String mutualFriends)
    {
        l = mutualFriends;
    }

    public String getPendingFriendRequests()
    {
        return m;
    }

    public void setPendingFriendRequests(String pendingFriendRequests)
    {
        m = pendingFriendRequests;
    }

    public String getBirthday()
    {
        return n;
    }

    public void setBirthday(String birthday)
    {
        n = birthday;
    }

    public void setIsVerified(boolean b)
    {
        verified = b;
    }

    public boolean getIsVerified()
    {
        return verified;
    }
    
    public void setFromJson(JSONObject json)
    {
        setId(json.optString(Field.USER_ID.name()));
        if(getId() == null || getId().length() == 0)
            setId(json.optString(Field.ID.name()));
        setDisplayName(json.optString(Field.DISPLAY_NAME.name()));
        setNickname(json.optString(Field.NICKNAME.name()));
        setThumbnailUrl(json.optString(Field.THUMBNAIL_URL.name()));
        setHasApp(json.optBoolean(Field.HAS_APP.name()));
        setAgeRestricted(json.optBoolean(Field.AGE_RESTRICTED.name()));
        setIsFamous(json.optBoolean(Field.IS_FAMOUS.name(), false));
        setAge(json.optInt(Field.AGE.name()));
        setGrade(json.optInt(Field.GRADE.name()));
        setMutualFriends(json.optString(Field.MUTUAL_FRIENDS.name()));
        setPendingFriendRequests(json.optString(Field.PENDING_FRIEND_REQUESTS.name()));
    }

    public JSONObject toJson()
    {
    	JSONObject obj = new JSONObject();
        try {
			obj.put(Field.USER_ID.name(), getId());
	        obj.put(Field.DISPLAY_NAME.name(), getDisplayName());
	        obj.put(Field.NICKNAME.name(), getNickname());
	        obj.put(Field.THUMBNAIL_URL.name(), getThumbnailUrl());
	        obj.put(Field.HAS_APP.name(), isHasApp());
	        obj.put(Field.AGE_RESTRICTED.name(), getIsAgeRestricted());
	        obj.put(Field.IS_FAMOUS.name(), getIsFamous());
	        obj.put(Field.AGE.name(), getAge());
	        obj.put(Field.GRADE.name(), getGrade());
	        obj.put(Field.MUTUAL_FRIENDS.name(), getMutualFriends());
	        obj.put(Field.PENDING_FRIEND_REQUESTS.name(), getPendingFriendRequests());
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return obj;
    }

    public JSONObject toJsonForUnity()
    {
    	JSONObject obj = new JSONObject();
        try {
	        obj.put(Field.ID.name(), getId());
	        obj.put(Field.DISPLAY_NAME.name(), getDisplayName());
	        obj.put(Field.NICKNAME.name(), getNickname());
	        obj.put(Field.THUMBNAIL_URL.name(), getThumbnailUrl());
	        obj.put(Field.ABOUT_ME.name(), getAboutMe());
	        obj.put(Field.HAS_APP.name(), isHasApp());
	        obj.put(Field.AGE_RESTRICTED.name(), getIsAgeRestricted());
	        obj.put(Field.IS_FAMOUS.name(), getIsFamous());
	        obj.put(Field.AGE.name(), getAge());
	        obj.put(Field.GRADE.name(), getGrade());
	        obj.put(Field.MUTUAL_FRIENDS.name(), getMutualFriends());
	        obj.put(Field.PENDING_FRIEND_REQUESTS.name(), getPendingFriendRequests());
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return obj;
    }

    public String getPassword()
    {
        return b;
    }

    public void setPassword(String password)
    {
        b = password;
    }

    public String toString()
    {
        return o.toString();
    }

    public void setJsonObject(JSONObject jsonObject)
    {
        o = jsonObject;
    }

    public int describeContents()
    {
        return 0;
    }

    public void writeToParcel(Parcel dest, int i1)
    {
        dest.writeString(getId());
        dest.writeString(getDisplayName());
        dest.writeString(getNickname());
        dest.writeString(getThumbnailUrl());
        dest.writeString(getAboutMe());
        dest.writeBooleanArray(new boolean[] {
            isHasApp(), getIsAgeRestricted(), getIsFamous()
        });
        dest.writeInt(getAge());
        dest.writeString(getMutualFriends());
        dest.writeString(getPendingFriendRequests());
    }

    private User(Parcel in)
    {
        a = "";
        b = "";
        c = "";
        d = "";
        e = "";
        f = "";
        g = false;
        h = false;
        i = false;
        j = 0;
        n = "";
        setId(in.readString());
        setDisplayName(in.readString());
        setNickname(in.readString());
        setThumbnailUrl(in.readString());
        setAboutMe(in.readString());
        boolean aflag[] = new boolean[3];
        in.readBooleanArray(aflag);
        setHasApp(aflag[0]);
        setAgeRestricted(aflag[1]);
        setIsFamous(aflag[2]);
        setAge(in.readInt());
        setMutualFriends(in.readString());
        setPendingFriendRequests(in.readString());
    }

    public String toJsonStringForTunnel()
    {
        return Tunnel.toString("User", toJson());
    }

    public void updateWithJsonObjectFromTunnel(JSONObject jsonObject)
    {
        try
        {
            jsonObject.put(Field.ID.name(), jsonObject.optString("uid"));
        }
        catch(JSONException _ex) { }
        setFromJson(jsonObject);
    }

    User(Parcel x0, byte byte0)
    {
        this(x0);
    }

    private String a;
    private String b;
    private String c;
    private String d;
    private String e;
    private String f;
    private boolean g;
    private boolean h;
    private boolean i;
    private int j;
    private int k;
    private String l;
    private String m;
    private String n;
    private JSONObject o;
    private boolean verified;

    public static final android.os.Parcelable.Creator<Object> CREATOR = new android.os.Parcelable.Creator<Object>() {

        public final Object[] newArray(int i1)
        {
            return new User[i1];
        }

        public final Object createFromParcel(Parcel parcel)
        {
            return new User(parcel, (byte)0);
        }

    }
;

}
